import React from 'react';
import { Form, Input, message } from 'antd';
import { FormList } from '@ecoding/components.antd';
import { ruleRequired, rulesGreater } from '@ecoding/components.antd.rules';

const C = () => {
    const [form] = Form.useForm(); 

    return (
        <Form form={form} preserve={false} layout="vertical">
            <FormList
                name="columnParams"
                rules={[rulesGreater("至少添加一项", 1)]}
                afterRemove={(index) => message.success(`删除了下标${index}`)}
                afterAdd={(index) => message.success(`新增了下标${index}`)}
                columns={[
                    {
                        require: true,
                        title: '源表头名',
                        rules: [ruleRequired("必填")],
                        name: 'sourceColumn',
                        render: (field, index) => (
                            <Input  />
                        )
                    }
                ]}
            />
        </Form>
    );
}

export default C;